<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/web1/cs_login/jquery-3.2.0.min.js"></script>
<script type="text/javascript">
	function verify(){
		var nickName=$("#nickName").val();
		if(nickName==''){
			$("#nickNameErr").show();
			return false;
		}
		var email=$("input[name='email']").val();
		var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
		if(!reg.test(email)){
			alert("输入的格式错误");
			return false;
		}
		return true;
	}
	
	function setValue(){
		$("#nickName").val("hello");
		$("input[name='email']").val("eee@qq.com");
		$("input[name='passwd']").val("eee");
		$("textarea[name='intro']").val("dasda");
		$("input[name='sex']:eq(1)").attr("checked",true);
	}
	function getValue(){
		var nickName=$("#nickName").val();
		var email=$("input[name='email']").val();
		var passwd=$("input[name='passwd']").val();
		var intro=$("textarea[name='intro']").val();
		var ischecked=$("input[name='sex']:checked").val();
		var radio1=$("input[name='sex']:eq(0)").attr("checked");
		var radio2=$("input[name='sex']:eq(1)").attr("checked");
		alert(nickName+"---"+email+"---"+intro);
	}
</script>
</head>
<body>
	<form action="/web1/UserDetailInsert" method="post" onsubmit="return verify()">
		昵称<input type="text" id="nickName" name="nickName"><div id="nickNameErr"style="display:none;color:red" >请输入昵称</div><br>
		邮箱<input type="text" name="email"><br>
		密码<input type="password" name="passwd"><br>
		<textarea rows="5" cols="50" name="intro"></textarea><br>
		<input type="radio" name="sex" value="0">女
		<input type="radio" name="sex" value="1">男
		<input type="submit" value="新增">
		<input type="button" value="设置值" onclick="setValue()"><br>
		<input type="button" value="取得值" onclick="getValue()"><br>
	
	</form>
</body>
</html>